//
//  YFCustomTextField.h
//  SquashSpark
//
//  Created by Coollang on 2017/11/13.
//  Copyright © 2017年 Coollang-YF. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "FUITextField.h"

typedef void(^LSTextfieldViewRightButtonClickedBlock)(NSString *text);
typedef void(^LSTextfieldViewTextChangeBlock)(NSString *text);

typedef void(^LSTextfieldViewDidBeginEditBlock)(NSString *text);
typedef void(^LSTextfieldViewDidEndEditBlock)(NSString *text);

typedef NS_ENUM(NSInteger,LSTextfieldViewType) {
    LSTextfieldViewTypeNormal,
    LSTextfieldViewTypePassword,
    LSTextfieldViewTypePhone,
    LSTextfieldViewTypeVerifyCode,
    LSTextfieldViewTypeEmail,
};

@interface YFCustomTextField : FUITextField
@property (nonatomic, copy) LSTextfieldViewRightButtonClickedBlock clickRightButtonHandler;
@property (nonatomic, copy) LSTextfieldViewTextChangeBlock textChangeHandler;

@property (nonatomic, copy) LSTextfieldViewDidBeginEditBlock textFieldDidBenginEidtHandler;
@property (nonatomic, copy) LSTextfieldViewDidEndEditBlock textFieldDidEndEidtHandler;

@property (nonatomic, assign,readonly) LSTextfieldViewType textfieldType;

@property (nonatomic, assign) NSInteger maxLength;

/** 键盘输入的文字需要校验的正则表达式, 如:年龄首字母不允许输入0 */
@property (nonatomic, copy)NSString *regExpCheck;

/** 是否显示右侧按钮 */
@property (nonatomic, assign)BOOL showRightButton;
@property (nonatomic, strong,readonly) UIButton *rightButton;

/** 是否需要显示白色2px的边框:默认为YES */
//@property (nonatomic, assign)BOOL showWhiteBoder;
/** 设置边框 */
- (void)changeCornerRadius:(CGFloat)radius borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor;

/** 开启对齐方式 中心和左侧自动切换:默认开启 */
@property (nonatomic, assign)BOOL autoAdjustAlimentCenterOrLeft;

- (void)changeTextfieldStyle:(LSTextfieldViewType)textfieldType;

// Placeholder
@property (nonatomic, assign)NSTextAlignment placeHolderAlignment;

@end
